﻿<ResourceDictionary
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   xmlns:seui="clr-namespace:SqlExport"
   >
	<ResourceDictionary.MergedDictionaries>
		<ResourceDictionary Source="Buttons.xaml" />
		<ResourceDictionary Source="Common.xaml" />
	</ResourceDictionary.MergedDictionaries>

	<Style x:Key="TabItemFocusVisual">
		<Setter Property="Control.Template">
			<Setter.Value>
				<ControlTemplate>
					<Rectangle SnapsToDevicePixels="true" Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" Margin="3,3,3,1"/>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="{x:Type seui:CloseableTabItem}" >
		<Setter Property="FocusVisualStyle" Value="{StaticResource TabItemFocusVisual}"/>
		<Setter Property="Foreground" Value="Black"/>
		<Setter Property="Padding" Value="6,1,6,1"/>
		<Setter Property="BorderBrush" Value="{StaticResource TabControlNormalBorderBrush}"/>
		<Setter Property="Background" Value="{StaticResource TabButtonNormalBackground}"/>
		<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
		<Setter Property="VerticalContentAlignment" Value="Stretch"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type seui:CloseableTabItem}">
					<Grid SnapsToDevicePixels="true">
						<Border x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,0" CornerRadius="4,4,0,0" Padding="1,1,1,2" Margin="0,0,-2,-1" >
							<DockPanel x:Name="ContentPanel">
								<seui:PathButton x:Name="PART_Close" 
												 DockPanel.Dock="Right" 
												 ToolTip="Close Tab"
												 EnabledFill="#FF969696"
												 DisabledFill="#FF969696"
												 PressedFill="#FF9D3838"
												 Path="F1 M 2,0.5 L 7,6 L 12,0.5 L 14,3 L 9,8 L 14,13 L 12,15 L 7,10 L 2,15 L 0,13 L 5,8 L 0,3 Z" />
								<ContentPresenter x:Name="Content" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Header" RecognizesAccessKey="True" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="{TemplateBinding Padding}"/>
							</DockPanel>
						</Border>
					</Grid>
					<ControlTemplate.Triggers>
						<Trigger Property="IsMouseOver" SourceName="PART_Close" Value="True">
							<Setter Property="EnabledFill" TargetName="PART_Close" Value="#FFB83C3D"/>
						</Trigger>
						<Trigger Property="IsMouseOver" Value="true">
							<Setter Property="Background" TargetName="Bd" Value="{StaticResource TabItemHotBackground}"/>
						</Trigger>
						<Trigger Property="IsSelected" Value="true">
							<Setter Property="Panel.ZIndex" Value="1"/>
							<Setter Property="Background" TargetName="Bd" Value="{StaticResource TabItemSelectedBackground}"/>
							<Setter Property="EnabledFill" TargetName="PART_Close" Value="#FFB83C3D" />
						</Trigger>
						<MultiTrigger>
							<MultiTrigger.Conditions>
								<Condition Property="IsSelected" Value="false"/>
								<Condition Property="IsMouseOver" Value="true"/>
							</MultiTrigger.Conditions>
							<Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource TabItemHotBorderBrush}"/>
						</MultiTrigger>
						<Trigger Property="TabStripPlacement" Value="Bottom">
							<Setter Property="BorderThickness" TargetName="Bd" Value="1,0,1,1"/>
						</Trigger>
						<Trigger Property="TabStripPlacement" Value="Left">
							<Setter Property="BorderThickness" TargetName="Bd" Value="1,1,0,1"/>
						</Trigger>
						<Trigger Property="TabStripPlacement" Value="Right">
							<Setter Property="BorderThickness" TargetName="Bd" Value="0,1,1,1"/>
						</Trigger>
						<MultiTrigger>
							<MultiTrigger.Conditions>
								<Condition Property="IsSelected" Value="true"/>
								<Condition Property="TabStripPlacement" Value="Top"/>
							</MultiTrigger.Conditions>
							<Setter Property="Margin" Value="-2,-2,-2,-1"/>
							<Setter Property="Margin" TargetName="ContentPanel" Value="0,0,0,1"/>
						</MultiTrigger>
						<MultiTrigger>
							<MultiTrigger.Conditions>
								<Condition Property="IsSelected" Value="true"/>
								<Condition Property="TabStripPlacement" Value="Bottom"/>
							</MultiTrigger.Conditions>
							<Setter Property="Margin" Value="-2,-1,-2,-2"/>
							<Setter Property="Margin" TargetName="ContentPanel" Value="0,1,0,0"/>
						</MultiTrigger>
						<MultiTrigger>
							<MultiTrigger.Conditions>
								<Condition Property="IsSelected" Value="true"/>
								<Condition Property="TabStripPlacement" Value="Left"/>
							</MultiTrigger.Conditions>
							<Setter Property="Margin" Value="-2,-2,-1,-2"/>
							<Setter Property="Margin" TargetName="ContentPanel" Value="0,0,1,0"/>
						</MultiTrigger>
						<MultiTrigger>
							<MultiTrigger.Conditions>
								<Condition Property="IsSelected" Value="true"/>
								<Condition Property="TabStripPlacement" Value="Right"/>
							</MultiTrigger.Conditions>
							<Setter Property="Margin" Value="-1,-2,-2,-2"/>
							<Setter Property="Margin" TargetName="ContentPanel" Value="1,0,0,0"/>
						</MultiTrigger>
						<Trigger Property="IsEnabled" Value="false">
							<Setter Property="Background" TargetName="Bd" Value="{StaticResource TabItemDisabledBackground}"/>
							<Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource TabItemDisabledBorderBrush}"/>
							<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

</ResourceDictionary>
